package com.zcp.service;

import com.zcp.dao.TagDAO;
import com.zcp.entity.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;


@Service
public class TagServiceImpl implements TagService{


    @Autowired
    private TagDAO tagDAO;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Tag> findAll() {
        return tagDAO.findAll();
    }

    @Override
    public void save(Tag tag) {
        tag.setCreatetime(new Date());
        tagDAO.save(tag);
    }

    @Override
    public Tag change(Integer id) {
        return tagDAO.change(id) ;
    }

    @Override
    public void changed(Tag tag) {
        tagDAO.changed(tag);
    }

    @Override
    public void delete(Integer id) {
        tagDAO.delete(id);
    }
}
